package it.eng.ws.test.useragent;

import org.apache.log4j.Logger;

import it.eng.ws.test.automata.Automata;
import it.eng.ws.test.configuration.ConfigurationManager;
import it.eng.ws.test.logging.LoggingSample;
import it.eng.ws.test.logging.SimpleLog;

public class Main {
	private static Logger l = null;

	public static void main(String args[]){
		if (l == null) {
			l = LoggingSample.getLogger(it.eng.ws.test.useragent.Main.class);
		}

		try {
			
			String xmlSchema="userAgentSpecs.xsd";
			String namespace="http://www.eng.it/ws/test/userAgent";
			//private static String xml="xsd/oneInstance.xml";
			String xml="userAgent.example.xml";
			SimpleLog.getInstance().setPathFilename("C:/Users/MEZZETTI/Desktop/LogFile");
			ConfigurationManager.getInstance().startConfiguration(namespace, xmlSchema, xml);
			int userAgents = ConfigurationManager.getInstance().getConcurrentUserAgents();
			Automata automata = ConfigurationManager.getInstance().getAutomata();
			for (int i = 0; i < userAgents; i++){
				Thread ua = new Thread(new UserAgent(automata));
				ua.start();
			}

		} catch (Exception e) {
			l.error(e.getMessage(),e);
		}

	}
	
}
